<ion-view view-title="详情">
  <ion-nav-buttons side="right">
    <button class="button button-icon icon ion-share" ng-click="shareTopic()"></button>
  </ion-nav-buttons>
  <ion-content class="has-header">
    <ion-refresher pulling-text="下拉刷新..." on-refresh="doRefresh()" >
    </ion-refresher>
    <div class="row topic">
      <div class="col col90">
        <h4 class="title">{{topic.title}}</h4>
        <div class="summary">
          <strong>
            <a href="#/user/{{topic.author.loginname}}">
              <img ng-src="{{topic.author.avatar_url | protocol}}" class="avatar">
              {{topic.author.loginname}}</a>
          </strong>
          <span class="item-note" am-time-ago="topic.last_reply_at"></span>
        </div>
        <div class="topic-content" ng-bind-html="topic.content | link">
        </div>
      </div>
    </div>
    <ion-list class="replies">
      <ion-item class="item-loading" ng-if="topic.replies == undefined">
        <span ng-if="!loadError">
          加载中...
        </span>
        <span ng-if="loadError">
          加载失败
        </span>
      </ion-item>
      <ion-item ng-if="topic.replies.length == 0">
        暂无评论
      </ion-item>
      <ion-item class="item-avatar" ng-repeat="reply in topic.replies" ng-click="showActions(reply)">
        <img ng-src="{{reply.author.avatar_url | protocol}}" ng-if="!settings.saverMode">
        <p>
          <a href="#/user/{{reply.author.loginname}}" ng-class="{'bold': reply.author.loginname == topic.author.loginname}">
            {{reply.author.loginname}}
          </a>
          <span class="item-note" am-time-ago="reply.create_at">
          </span>
          <span class="item-note cnode" ng-if="reply.ups.length > 0">
            <i class="icon ion-thumbsup"></i>
            {{reply.ups.length}}
            &nbsp;
          </span>
        </p>
        <div class="reply-content" ng-bind-html="reply.content | link"></div>
      </ion-item>
    </ion-list>
    <br />
  </ion-content>
  <ion-footer-bar align-title="left" class="bar-light reply-new" keyboard-attach>
    <label class="item-input-wrapper">
      <input type="text" placeholder="回复" ng-model="replyData.content" ng-disabled="loginName == null">
    </label>
    <button class="button button-small button-clear button-positive" ng-click="saveReply()" ng-class="{'disabled':loginName == null || replyData.content == ''}">
      提交
    </button>
  </ion-footer-bar>
</ion-view>
